<?php
namespace App\Http\Controllers\Admin;

use App\Models\Game;
use App\Http\Resources\Admin\Games as GameCollection;

class GamesController extends Controller
{
    public function index()
    {
    	$orderBy = $this->getOrderByQuery([
    		'id',
    		'map_id',
    		'status',
    		'type',
    		'created_at'
    	]);

    	$result = Game::orderByRaw($orderBy)
    	->orderByDesc('id')
    	->paginate(per_page());
        return new GameCollection($result);
    }
}
